<style>
.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th {
	padding: 5px;
	line-height:1.42857143;
	vertical-align:top;
	border-top:1px solid #ddd;
}
.closebtn {
    width: 30px;
    height: 30px;
    position: absolute;
    top: -30px;
    right: -10px;
    border-radius: 30px;
    text-align: center;
    line-height: 30px;
	font-size:24px;
    color: #fff;
}
.goods-list-table .goods-list-op .fa-edit{
    color: #5cb85c
}
.goods-list-table .goods-list-op .fa-trash-o{
    color: #d9534f
}
.goods-list-table .goods-list-num{
    font-size:12px;
	text-align:left;
}
.goods-list-table .goods-list-title{
	height:45px;
	line-height:23px;
    font-size:16px;
}
.goods-list-table .goods-list-title:hover{
	color: #f60;
}
.goods-list-table .goods-list-item {
	-webkit-border-radius: 4px;
    width: 16.66%;
	height: 120px;
    padding:0 10px 10px 0;
	float:left;
}
.goods-list-table .goods-list-item a{
	width: 100%;
    color: #fff;
    text-decoration: none;
}
.margin0 {
	margin:0px
}
/* 分割线 */
.fui-line {height: auto; display: block; position: relative; background: inherit;}
.fui-line:before {content: " "; position: absolute; top: 50%; left: 0; width: 100%; height: 1px; background: #d5d5d5;}
.text {height: 100%; width: auto; margin: 5px; background: inherit; font-size: 18px; display: table; position: relative;}
.text.big { font-size:0.8rem}
.text.large { font-size:1rem}
.yuyue-duan {border: 1px solid #19b955;border-radius: 4px;padding:0.1rem;height:auto;width:90px;margin:8px;font-size:12px;text-align:center}
.yuyue-duan span {width:100%;text-align:center}
.timeischack{background:#19b955;color:#fff}
.clear{clear:both;}
.fui-footer.quick {
    background: #474749;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    z-index: 30;
}
.fui-footer.quick .quick-cart {
    width: 3.6rem;
    position: relative;
}
.fui-footer.quick .quick-cart.an {
    animation: cartan 0.5s;
}
.fui-footer.quick .quick-info {
    width: 100%;
    padding: 0.3rem 0.4rem;
    line-height: 0.8rem;
    font-size: 12px;
    color: #fff;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
}
.fui-footer.quick .quick-info .price {
    font-size: 16px;
    line-height: 16px;
}
.fui-footer.quick .quick-submit {
	min-width:140px;
	text-align:center;
    height: 50px;
    padding: 0 1.2rem;
    line-height: 2.5rem;
    background: #ff9d55;
    color: #fff;
    display: inline-block;
}
.fui-footer.quick .quick-submit.disabled {
    background: #5c5c5f;
}
/* 数量选择器 */
.quick-num {
    height: 22px;
    width: auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}
.quick-num.open .minus {
    -moz-transition-duration: 300ms;
    -webkit-transition-duration: 300ms;
    transition-duration: 300ms;
    -webkit-transform: translate3d(0, 0, 0) rotate(0deg);
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
}
.quick-num.open .num {
    -moz-transition-duration: 300ms;
    -webkit-transition-duration: 300ms;
    transition-duration: 300ms;
    opacity: 1;
}
.quick-num.close .minus {
    animation: closeminus 0.2s;
    animation-fill-mode : forwards;
}
.quick-num.close .num {
    -moz-transition-duration: 100ms;
    -webkit-transition-duration: 100ms;
    transition-duration: 100ms;
    opacity: 0;
}
.quick-num .minus,
.quick-num .plus {
    height: 24px;
    width: 24px;
    line-height: 22px;
    font-size: 24px;
    text-align: center;
    border-radius: 100%;
}
.quick-num .minus {
    color: #ff5555;
    border: 1px solid #ff5555;
    -webkit-transform: translate3d(200%, 0, 0) rotate(90deg);
    transform: translate3d(200%, 0, 0) rotate(90deg);
    -webkit-transition-property: -webkit-transform;
    transition-property: transform;
    background: #fff;
    opacity: 0;
    position: relative;
    z-index: 8;
}
.quick-num .minus.disabled {
    color: #dadada;
    border-color: #dadada;
}
.quick-num .plus {
    background: #ff5555;
    color: #fff;
    position: relative;
    z-index: 11;
}
.quick-num .plus.disabled {
    background: #dadada;
}
.quick-num .num {
    height: 24px;
    line-height: 24px;
    font-size: 17px;
    min-width: 24px;
    padding: 0 4px;
    text-align: center;
    color: #777;
    opacity: 0;
}
.i-add-btn{
  width:20px;  line-height:20px; text-align:center; border-radius:10px;  font-size:10px;
  background-color:#FE4F4E;
  color: #fff;
}
.i-remove-btn{
  border: 1px solid #a7a2a9; width:20px;   line-height:20px; text-align:center;
  border-radius:10px; font-size:10px
}
.fui-cell-title{padding:5px;font-size: 15px;}
.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-12{padding:0}
th, td {
   text-align: left;
}
.c{text-align: center;}

.syscolor{
    background-color: {{main.syscolor||'#333333'}};
}

</style>
<div class="row">
		<div style='width:100%;'>
        <table style='width:100%;'>
            <tr>
            <td class="phone-main" style='width:380px;padding:10px;' valign='top'>
				<div style="font-weight:bold;font-size:20px;padding-bottom:10px">当前工号：{{pagedata.jobnum}} <span  class="red">工作中</span>
				<a ng-if="pagedata.oldorder.id" class="btn btn-warning btn-sm clear-btn" style="margin-left:15pxfont-size:15px" href="javascript:" ng-click="post(pagedata.post,'/worker.kaiyao/print4/');">打印结账单</a>
				<a  class="btn btn-warning btn-sm clear-btn" style="margin-left:15pxfont-size:15px" href="javascript:" onclick="javascript:history.go(0);">刷新页面</a>
				</div>
				<div class="diy-phone" style='width:380px;'>
					<div class="phone-body">
					<div class="phone-main ui-sortable" id="phone">
					<div>
						<div class="fui-cell-title">
							<div class="input-group">
							<input type="text" name="productsn"  ng-model="pagedata.productsn" class="form-control" placeholder="请扫描或输入国家药品条码"/>
							<div class="input-group-btn">
								 <input type="button" value="查询" class="btn" ng-click="pagedata.getgoods()"/>
							 </div>
							</div>
						</div>
						 <div ng-if="pagedata.oldorder.id" class="fui-cell-title">
							<span class="bold">已下单药品</span>
						</div>
						<div ng-if="pagedata.oldorder.id">
							<div class="table table-hover" id="native-scroll" style="min-width:100%;">
								<div class="row" style="margin:5px;font-size:16px;color:#f60"><span class="col-sm-8">药品名称</span><span class="col-sm-2">数量</span><span class="col-sm-2">单价</span></div>
								<div class="row" ng-repeat="(key,item) in pagedata.oldorder.goods">
									<a ng-class="{'row margin0':1,'selected':pagedata.index==$index}" href="javascript:" ng-click="pagedata.editdata=item;pagedata.index=$index;">
									<div ng-class="{'row margin0':1,'selected':pagedata.index==$index}" style="padding:10px 0;border-bottom: 1px solid #d9d9d9" ng-if="item.optionid==0">
									<div class="col-sm-8">{{item.title}}<span>({{item.isdiscount}})</span></div>
									<div class="col-sm-2 total">{{item.total}}</div>
									<div class="col-sm-2">¥<font>{{item.price}}</font></div>
									</div>
									<div ng-class="{'row margin0':1,'selected':pagedata.index==$index}" style="padding:10px 0;border-bottom: 1px solid #d9d9d9" ng-if="item.optionid>0">
									<div class="col-sm-8">{{item.title}}-[{{item.selespename}}]<span>({{item.isdiscount}})</span></div>
									<div class="col-sm-2 total">{{item.total}}</div>
									<div class="col-sm-2">¥<font>{{item.price}}</font></div>
									</div>
									</a>
									<div ng-if="pagedata.editdata.id>0 && pagedata.index==$index" class='fui-list c' style="background:#f2f2f2;padding:0.2rem 0.3rem">
										<a href="javascript:" class='fui-list-inner' ng-click="pagedata.tuicai();">
											<i class="icon icon-shanchu1" style="font-size:0.6rem;color:#999">退药品</i>
										</a>
										<a  href="javascript:" class='fui-list-inner' ng-click="pagedata.showdaizhe=true;">
											<i class="icon icon-viewlist" style="font-size:0.6rem;color:#999">设置打折</i>
										</a>
										<a ng-if="item.total>1" href="javascript:" class='fui-list-inner' ng-click="pagedata.showtuicainum=true;">
											<i class="icon icon-zhifeiji" style="font-size:0.6rem;color:#999">退数量</i>
										</a>
										<a ng-if="pagedata.editdata.price>0" href="javascript:" class="fui-list-inner" ng-click="pagedata.songcai()">
											<i class="icon icon-zidingyileimu" style="font-size:0.6rem;color:#999">赠送药品</i>
										</a>
									</div>
								</div>
							</div>
						</div>
						<div class="fui-cell-title">
							<span class="bold" ng-if="!pagedata.oldorder.id">药单信息</span>
							<span ng-if="pagedata.oldorder.id>0" class="bold red">追加药品</span>
							<a class="btn btn-warning btn-sm clear-btn" style="padding:2px;" href="javascript:" ng-click="unsetcarts();">清空药篮</a>
						</div>
						<div class="table-responsive">
							<div class="table table-hover" id="native-scroll" style="min-width:100%;">
								<div class="row" style="margin:5px;font-size:16px;color:#f60"><span class="col-sm-5">药品名称</span><span class="col-sm-2">数量</span><span class="col-sm-2">单价</span><span class="col-sm-3">操作</span></div>
								<div class="row" ng-repeat="(key,item) in pagedata.carts">
									<div class="row margin0" style="padding:10px 0;border-bottom: 1px solid #d9d9d9" ng-if="!item.options">
									<div class="col-sm-5">{{item.title}}</div>
									<div class="col-sm-2 total">{{item.num}}</div>
									<div class="col-sm-2">¥<font>{{item.price}}</font></div>
									<div class="col-sm-3"><a href="javascript:" ng-click="plusup2(key,-1);"><i class="i-add-btn fa fa-plus" ></i></a> {{item.num}} <a href="javascript:" ng-click="minusup2(key,-1);"><i class="i-remove-btn fa fa-minus"></i></a></div>
									</div>
									<div class="row margin0" style="padding:10px 0;border-bottom: 1px solid #d9d9d9" ng-repeat="(k,v) in item.options" ng-if="v.num>0">
									<div class="col-sm-5">{{item.title}}-[{{v.title}}]</div>
									<div class="col-sm-2 total">{{v.num}}</div>
									<div class="col-sm-2">¥<font>{{v.price}}</font></div>
									<div class="col-sm-3"><a href="javascript:" ng-click="plusup2(key,k);"><i class="i-add-btn fa fa-plus" ></i></a> {{v.num}} <a href="javascript:" ng-click="minusup2(key,k);"><i class="i-remove-btn fa fa-minus"></i></a></div>
									</div>
								</div>
							</div>
						</div>
						<div class="fui-cell-title">
						    <div class="bold" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">储值抵扣:<strong class="text-danger">-￥{{price(pagedata.oldorder.deduction)}}</strong></div>
						    <div class="bold" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">优惠劵抵扣:<span class="text-danger">-￥{{price(pagedata.oldorder.coupon_de_price)}}</span></div>
						    <div class="bold" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">会员折扣:<span class="text-danger">-￥{{price(pagedata.oldorder.level_de_price)}}</span></div>
						    <div class="bold" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">抹零价格:<strong class="text-danger">-￥{{price(pagedata.oldorder.molin_price)}}</strong></div>
						    <div class="bold" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">实付价格:<strong class="text-danger">{{price(pagedata.oldorder.price)}}</strong></div>
							<div class="bold">合计药品价格:<strong class="text-danger" id="goodsprice">{{price(pagedata.allprice)}}</strong></div>
						</div>
				</div>
				<form ng-if="!pagedata.oldorder.id || pagedata.oldorder.status==0" action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
					<div class="panel panel-default">
						<div class="panel-heading">
							<div class="row-fluid">
								<div class="span3 control-group">
									<span class="bold">用户信息</span>
								</div>
							</div>
						</div>
						<div class="panel-body">
							<div class="form-group">
								<label class="col-xs-12 col-sm-3 col-md-2 col-lg-3 control-label">患者姓名</label>
								<div class="col-sm-10 col-lg-9">
									{{pagedata.item.username}}({{pagedata.item.mobile||'无'}}).{{pagedata.item.sex}}
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-12 col-sm-3 col-md-2 col-lg-3 control-label">问诊医生</label>
								<div class="col-sm-10 col-lg-9">
									{{pagedata.item.workertitle}}
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-12 col-sm-3 col-md-2 col-lg-3 control-label">问诊详情</label>
								<div class="col-sm-10 col-lg-9">
									{{pagedata.item.remark}}
								</div>
							</div>  
							<div class="form-group">
								<label class="col-xs-12 col-sm-2 col-md-2 col-lg-3 control-label">手机号</label>
								<div class="col-sm-10 col-lg-9">
									<div class="input-group">
									<input type="text" name="mobile" ng-model="pagedata.post.mobile" class="form-control" value="" placeholder="输入会员手机号"/>
									<div class="input-group-btn">
										<input type="button" value="查询" class="btn" ng-click="pagedata.getmember()"/>
									 </div>
									</div>
								</div>
							</div>
							<div class="form-group" ng-if="(!pagedata.oldorder.id || pagedata.post.topay==1) && pagedata.post.member.nickname">
									<div class="col-sm-12">
										<div class="input-group">
											<div class="input-group-addon">联系人</div>
											<input type="text" class="form-control"  ng-model="pagedata.post.member.nickname" readonly/>
										</div>
										<div class="input-group">
											<div class="input-group-addon">账户余额</div>
											<input type="text" class="form-control" ng-model="pagedata.post.member.credit2" readonly/>
											<div class="input-group-addon">抵用金额</div>
											<input type="text" class="form-control" ng-model="pagedata.post.deduction" readonly style="color: #a94442 !important;font-weight:bold;"/>
										</div>
									</div>
							</div>
							<div class="form-group" ng-if="(!pagedata.oldorder.id || pagedata.post.topay==1) && pagedata.post.mid>0">
								<label class="col-xs-12 col-sm-2 col-md-2 col-lg-3 control-label">
									可用优惠券</label>
								<div class="col-sm-10 col-lg-9">
									<div class="input-group">
									<input type="text" ng-model="pagedata.post.title5" class="form-control" readonly />
									<div class="input-group-btn">
										  <input type="button" value="查看" class="btn" ng-click="pagedata.showcoupon=true"/>
									 </div>
									</div>
								</div>
							</div>
							<div  class="form-group" ng-if="(!pagedata.oldorder.id || pagedata.post.topay==1) && pagedata.post.mid>0 && false">
    							<label class="col-xs-12 col-sm-2 col-md-2 col-lg-3 control-label">
									销售业务员</label>
    							<div class="col-sm-10 col-lg-9">
                                    <div class="input-group">  
    									<input type="text" class="form-control" placeholder="请选择业务员" ng-model="pagedata.post.storeworkerid" ng-readonly="true"/>
    								
    									<span ng-if="pagedata.merchid>0" class="input-group-btn">
    										<button class="btn btn-gray"  type="button" ng-click="pagedata.showxzywy=true;"><i class="fa fa-external-link"></i>选择</button>
    									</span>
                                    </div>
                                </div>
                            </div>
							
							<div class="form-group">
								<label class="col-xs-12 col-sm-2 col-md-2 col-lg-3 control-label">
									备注</label>
								<div class="col-sm-10 col-lg-9">
									<textarea name="remark" id="remark" style="height:80px;" ng-model="pagedata.post.remark" class="form-control">{{pagedata.post.remark}}</textarea>
								</div>
							</div>
						</div>
						<div ng-if="(!pagedata.oldorder.id || pagedata.post.topay==1)" class="panel-footer">
							 <h5 id="totalprice">药单总价:<strong class="text-danger">{{price(pagedata.orderprice)}}</strong></h5>
							 <h5 ng-if="pagedata.post.coupon_de_price>0">优惠券抵扣：<strong class="text-danger">-￥{{price(pagedata.post.coupon_de_price)}}</strong></h5>
							 <h5 ng-if="pagedata.post.level_de_price>0">会员折扣：<strong class="text-danger">-￥{{price(pagedata.post.level_de_price)}}</strong></h5>
							 <h5 id="totalprice">实付金额:<strong class="text-danger">{{price(pagedata.endprice)}}</strong> 
							 <span class="btn btn-sm btn-primary" ng-if="pagedata.oldorder.id && pagedata.endprice>0" ng-click="pagedata.newendprice=pagedata.endprice;pagedata.showgaiprice=true" style="margin-left:10px">改价抹零</span>
							 <!--<span class="btn btn-sm btn-primary" ng-click="pagedata.showdzprice=true" style="margin-left:10px">打折操作</span>-->
							 </h5>
						</div>
								</div>
							</form>
						</div>
					 </div>
				 </div>
				  <div class="fui-cell-title c" id="qrcode" ng-if="(!pagedata.oldorder.id || pagedata.oldorder.status==0) && pagedata.post.topay==1 && pagedata.post.paytype==0">
						 <div class="input-group" style="width:100%;padding-bottom:10px">
							 <input type="text" class="form-control" name="data[auth_code]" ng-model="pagedata.post.auth_code" value="" data-rule-required="true" placeholder="请扫描或输入微信付款码"/>
						 </div>
						 <button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.gopay();">确认收款</button>
				   </div>
				   <div class="fui-cell-title c" id="submit" ng-if="(!pagedata.oldorder.id || pagedata.oldorder.status==0) &&pagedata.post.topay==1 && pagedata.post.paytype!=0">
						<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.gopay();">确认收款</button>
					</div>
			
					<div class="fui-cell-title c" id="submit" ng-if="(!pagedata.oldorder.id || pagedata.oldorder.status==0) && pagedata.post.topay==0 && pagedata.post.paytype!=0">
						<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.gopay();">确认开药</button>
					</div>

					<div class="fui-cell-title c" id="submit" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==1">
							<button class="btn btn-primary" style="width:250px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="post(pagedata.post,'/manage.posgoods1/status3/');">
								药单已支付，点击完成药单
							</button>
					</div>
					<div class="fui-cell-title c" id="submit" ng-if="pagedata.oldorder.id && pagedata.oldorder.status==4">
							<button class="btn btn-gray" style="width:250px;border-radius:20px;font-size:18px;">
								药单已取消
							</button>
					</div>
					<div class="fui-cell-title c" ng-if="pagedata.payloading">
						 <i class='fa fa-spinner fa-spin'>正在刷新处理状态...</i>
					</div>
			</td>
			<td valign='top' style='padding:10px;'>
			<div class="fui-cellone" style='padding:0;'>
				<div class="fui-cellone-info">
				
				</div>
				<div class="fui-cellone-remark">
					<div class="col-sm-10 col-lg-12">
						<div class="input-group">
							<input type="text" name="mobile" placeholder="请输入药品名称快捷查询" ng-model="pagedata.params.title" class="form-control" value=""/>
							<div class="input-group-btn">
								<input type="button" value="搜索" class="btn" ng-click="pagedata.getlist(1);"/>
						    </div>
						</div>
					</div>
						
				</div>
			</div>
			<ul class="nav nav-tabs" ng-if="pagedata.groups">
				<li ng-class="{'active':pagedata.params.pcate==0}"><a href="javascript:;" ng-click="pagedata.params.pcate=0;pagedata.getlist(1);">全部</a></li>
				<li ng-repeat="tab in pagedata.groups" ng-class="{'active':pagedata.params.pcate==tab.id}">
				<a href="javascript:;" ng-click="pagedata.params.pcate=tab.id;pagedata.getlist(1);">{{tab.title}}</a>
				</li>
			</ul>
        <div class="panel panel-default">
            <div class="panel-heading">
                请选择药品<span ng-if="pagedata.oldorder.id>0" class="bold red">【{{pagedata.oldorder.ordersn}}】追加药品</span>
            </div>
            <div class="table-responsive panel-body">
                    <div class="goods-list-table">
                        <div class="goods-list-item" ng-repeat="item in pagedata.list">
                            <div class="syscolor" style="padding:5px" ng-show="item.isoption !=1">
								<a  href="javascript:" ng-click="addfoot(item.id,item);" id="dishid_{{item.id}}" dishid="{{item.id}}">
									<div class="goods-list-num">{{item.id}}</div>
									<div class="goods-list-title">
										<span>{{item.title}}</span>
									</div>
									<div class="goods-list-price" style="overflow: hidden;">
										<span class="l">￥{{item.price}}</span>
	
										<span class="r"><i class="fa fa-plus"></i></span>
									</div>
									<div class="goods-list-price" style="overflow: hidden;" ng-if="item.vipprice>0">
										<span class="l" style="font-weight:bold;">会员价:￥{{item.vipprice}}</span>
									</div>
									<div class="goods-list-price" style="overflow: hidden;" ng-if="item.vipprice==0">
										<span class="l">&nbsp;</span>
									</div>
								</a>
							</div>
							<div class="syscolor" style="padding:5px" ng-show="item.isoption ==1">
							<a href="javascript:" onclick="$('#selecttaocan').modal();" ng-click="pagedata.goodsid=item.id;">
								<div class="goods-list-num">{{item.id}}</div>
								<div class="goods-list-title" style="overflow: hidden;">
									<span>{{item.title}}</span>
								</div>
								<div class="goods-list-price" style="overflow: hidden;">
									<span class="l">￥{{item.price}}</span>
									<span  class="r">选规格</span>
								</div>
								<div class="goods-list-price" style="overflow: hidden;" ng-if="item.vipprice>0">
										<span class="l" style="font-weight:bold;">会员价:￥{{item.vipprice}}</span>
								</div>
								<div class="goods-list-price" style="overflow: hidden;" ng-if="item.vipprice==0">
										<span class="l">&nbsp;</span>
								</div>
                            </a>
							</div>
                        </div>
                        <div class="space"></div>
                    </div>
            </div>
			<div class="page" style="margin-left:0;">
				<!-- 分页导航 -->
				<div ng-include="sys_html('common/pagenew',true)"></div>
			</div>
        </div>
		</td>
		 </tr>
        </table>
</div>
</div>
	<div id="selecttaocan" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
					<div class="modal-dialog">
						<div class="modal-content" style="border-radius: 4px;">
								<div aria-hidden="true" data-dismiss="modal" class="closebtn"><i class="fa fa-times-circle-o" style="font-size:30px"></i></div>				
								<div class="text text-danger">{{pagedata.list[pagedata.goodsid].title}}</div>
								<div class="row margin0">
									<div ng-repeat="(k,spec) in pagedata.list[pagedata.goodsid].specs_list" class="option-picker-cell option spec" style="padding:10px">
										<h5 class="title">{{spec.title}}</h5>
										<div class="select">
											 <a ng-repeat="item in spec.items" href="javascript:;" ng-click="pagedata.get_optionsid(k,item.id);" ng-class="{'btn btn-gray btn-sm spec-item':1,'btn-default':pagedata.carts[pagedata.goodsid].specid[k]==item.id}" style="margin-right:5px;margin-bottom:5px"> {{item.title}} </a>
										</div>
									</div>
								</div>
								<div class="row margin0" style="padding-top:16px">
									<div class="fui-footer quick" style="height:42px;">
											<div class="quick-info" style="background:#ff5555;height:42px">
												<p class="price" style="font-size:0.8rem;line-height:30px">￥{{pagedata.list[pagedata.goodsid].options.price || '0.00'}}/份</p>
											</div>
											<a ng-show="pagedata.carts[pagedata.goodsid].options[pagedata.list[pagedata.goodsid].options.id].num==0" class="quick-submit" style="height:42px;margin: 0;font-size:0.65rem;line-height:42px" href="javascript:;" ng-click="plusup();">加入药篮</a>
											<div ng-show="pagedata.carts[pagedata.goodsid].options[pagedata.list[pagedata.goodsid].options.id].num>0"class="quick-submit" style="height:42px;margin: 0;font-size:0.8rem;line-height:42px;">
												<div class="quick-num open" style="margin-top:10px">
													<div ng-click="minusup();" class="minus fa fa-minus" style="background: none; color: #fff; border: 1px solid #fff;font-size: 16px;"></div>
													<div class="num" style="color:#fff">{{pagedata.carts[pagedata.goodsid].options[pagedata.list[pagedata.goodsid].options.id].num}}</div>
													<div ng-click="plusup();" class="plus fa fa-plus" style="background: none;border: 1px solid #fff;font-size: 16px;"></div>
												</div>
											</div>
									</div>
								</div>
								<div class="clear"></div>
						</div>
					</div>
</div>
<div ng-if="pagedata.showcoupon" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showcoupon=false"></i>
			<div ng-include="sys_html('coupon/common/_picker','','','jy_weishop')"></div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showgaiprice" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px;height:auto;">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showgaiprice=false"></i>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">改之前价格</div>
						<input type="text" class="form-control" ng-model="pagedata.endprice" readonly/>
					</div>
			</div>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">药单号</div>
						<input type="text" class="form-control" ng-model="pagedata.oldorder.ordersn" readonly/>
					</div>
			</div>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">最终价格</div>
					    
						<input type="text" class="form-control" ng-model="pagedata.editdata.newendprice"/>
					</div>
			</div>
			<div class="fui-cell-title c" style="padding-top:20px">
				<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.gaiprice();">提交</button>
			</div>
		</div>
	</div>
</div>

<div ng-if="pagedata.showdzprice" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px;height:auto;">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showdzprice=false"></i>
			<!--<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">打折前价格</div>
						<input type="text" class="form-control" ng-model="pagedata.endprice" readonly/>
					</div>
			</div>-->
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">打折折扣</div>
					    <input type="hidden" class="form-control" ng-model="pagedata.editdata.ordersn"/>
						<input type="number" class="form-control" ng-model="pagedata.editdata.discount" placeholder="请输入折扣数字1-10之间"/>
					</div>
			</div>
			<div class="fui-cell-title c" style="padding-top:20px">
				<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.dzprice();">提交</button>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showdaizhe" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px;height:auto;">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showdaizhe=false"></i>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">打折状态</div>
						<select class="form-control"  ng-model="pagedata.editdata.isdiscount" autocomplete="off">
							<option value="1">不打折</option>
							<option value="0">打折</option>
						</select>
					</div>
			</div>
			<div class="fui-cell-title c" style="padding-top:20px">
				<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.dazhe();">提交</button>
			</div>
		</div>
	</div>
</div>


<div ng-if="pagedata.showxzywy" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px;height:auto;">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showxzywy=false"></i>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">药单号</div>
						<input type="text" class="form-control" ng-model="pagedata.oldorder.ordersn" readonly/>
					</div>
			</div>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">请选择业务员</div>
						<select class="form-control"  ng-model="pagedata.editdata.storeworkerid" autocomplete="off">
							<option ng-repeat="item in pagedata.ywyber" value="{{item.mid}}">{{item.name}}(工号:{{item.jobnum}})</option>
						</select>
					</div>
			</div>
			<div class="fui-cell-title c" style="padding-top:20px">
				<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.xzymy();">提交</button>
			</div>
		</div>
	</div>
</div>

<div ng-if="pagedata.showtuicainum" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-top:1rem;width:660px;height:auto;">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showtuicainum=false"></i>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">原有数量</div>
						<input type="text" class="form-control" ng-model="pagedata.editdata.total" readonly/>
					</div>
			</div>
			<div class="fui-cell-title" style="padding:10px 50px">
					<div class="input-group">
					<div class="input-group-addon">退数量</div>
						<input type="text" class="form-control" ng-model="pagedata.editdata.tuinum"/>
					</div>
			</div>
			<div class="fui-cell-title c" style="padding-top:20px">
				<button class="btn btn-primary" style="width:200px;border-radius:20px;font-size:18px;" href="javascript:" ng-click="pagedata.tuicainum();">提交</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
scope.pagedata.post.topay='0'
scope.pagedata.carts={}
scope.pagedata.selected = 0;  //状态标记
scope.pagedata.orderprice = 0;

//刷新总数和总价
scope.pagedata.refresh=function(){
	var carts=scope.pagedata.carts
	var goodsprice=0;
	 angular.forEach(carts,function(cart){
		cart.num=parseInt(cart.num);
		console.log(cart.price);
		if(parseFloat(cart.price)>0){
			goodsprice +=cart.price*cart.num;
		}
	 });
	 if(scope.pagedata.oldorder && scope.pagedata.oldorder.goodsprice>=0){
		 goodsprice +=parseFloat(scope.pagedata.oldorder.goodsprice);
	 }
	scope.pagedata.allprice=goodsprice;
	scope.pagedata.orderprice = scope.pagedata.allprice;
	scope.pagedata.endprice=scope.pagedata.orderprice;
	if(scope.pagedata.post.level_de_price>0){
	    scope.pagedata.endprice-=parseFloat(scope.pagedata.post.level_de_price);
	    if(scope.pagedata.endprice<0){
			scope.pagedata.endprice=0;
		}
		scope.pagedata.post.endprice=scope.pagedata.endprice;
	}
	if(scope.pagedata.post.coupon_de_price>0){
		scope.pagedata.endprice-=parseFloat(scope.pagedata.post.coupon_de_price);
		if(scope.pagedata.endprice<0){
			scope.pagedata.endprice=0;
		}
		scope.pagedata.post.endprice=scope.pagedata.endprice;
	}
	
	
	if(scope.pagedata.post.member && scope.pagedata.post.member.credit2>0){
		if(scope.pagedata.endprice>=scope.pagedata.post.member.credit2){
			scope.pagedata.post.deduction=scope.pagedata.post.member.credit2
		}else{
			scope.pagedata.post.deduction=scope.pagedata.endprice;
		}
		scope.pagedata.endprice -=parseFloat(scope.pagedata.post.deduction);
		scope.pagedata.post.endprice=scope.pagedata.endprice;
	}
	//计算会员的最终价格
	
	if(scope.pagedata.post.lsprice>0 && scope.pagedata.post.memberprice>0){
		
		if(scope.pagedata.endprice<0){
			scope.pagedata.endprice=0;
		}
		if(!scope.pagedata.post.coupon_de_price){
		    scope.pagedata.post.coupon_de_price=0;
		}
		if(!scope.pagedata.post.deduction){
		    scope.pagedata.post.deduction=0;
		}
		scope.pagedata.endprice = parseFloat(scope.pagedata.post.memberprice - scope.pagedata.post.coupon_de_price - scope.pagedata.post.deduction);
	}
	scope.$evalAsync();
}
scope.pagedata.refresh();
//var timeleft = 60; // 设定初始时间为60秒
/*var downloadTimer = setInterval(function(){
    timeleft--; // 时间减一秒
    document.getElementById("countdown").textContent = "倒计时：" + timeleft + "秒"; // 显示时间到页面上
    if(timeleft <= 0){ // 当倒计时结束时
            clearInterval(downloadTimer); // 停止计时器
            document.getElementById("countdown").textContent = "倒计时结束"; // 显示倒计时结束到页面上
    }
}, 1000); // 每秒执行一次*/
scope.update=function(goodsid,num,optionsid){
	scope.pagedata.post.carts=scope.pagedata.carts;
	/*var params={
		data:{'num':num,'goodsid':goodsid,'optionsid':optionsid},
		op:'diancai',
		callback:function(res){
			if(res.options.id){
				
				scope.$evalAsync();
			}
			
		}
	};
	scope.post_json(params);*/
}
scope.minusup2 = function(goodsid,optionsid){
		console.log(goodsid);
		console.log(optionsid);
		if(optionsid !=-1){
			if(scope.pagedata.carts[goodsid].options[optionsid].num <2){
				delete scope.pagedata.carts[goodsid]
				return false
			}else{
				scope.pagedata.carts[goodsid].options[optionsid].num --
				var num = scope.pagedata.carts[goodsid].options[optionsid].num
			}
			var price = scope.pagedata.list[goodsid].options.price
			
		}else{
			if(scope.pagedata.carts[goodsid].num <2){
				delete scope.pagedata.carts[goodsid]
			}else{
				scope.pagedata.carts[goodsid].num --
				var num = scope.pagedata.carts[goodsid].num
			}
			var price = scope.pagedata.list[goodsid].price
			
		}
		scope.update();
		scope.pagedata.allprice -= parseInt(price);
		scope.pagedata.orderprice = scope.pagedata.allprice;
		scope.pagedata.refresh();
}
scope.plusup2 = function(goodsid,optionsid){
		if(optionsid !=-1){
			scope.pagedata.carts[goodsid].options[optionsid].num ++
			var price = scope.pagedata.list[goodsid].options.price
		}else{
			scope.pagedata.carts[goodsid].num ++
			var price = scope.pagedata.list[goodsid].price
		}
		scope.update();
		scope.pagedata.allprice += parseInt(price);
		scope.pagedata.orderprice = scope.pagedata.allprice;
		scope.pagedata.refresh();
}
scope.minusup = function(){
		var goodsid =scope.pagedata.goodsid;
		var optionsid = scope.pagedata.list[goodsid].options.id
		if(scope.pagedata.carts[goodsid].options[optionsid].num <=1){
			delete scope.pagedata.carts[goodsid]
		}else{
			scope.pagedata.carts[goodsid].options[optionsid].num --
			var num = scope.pagedata.carts[goodsid].options[optionsid].num
		}
		var price = scope.pagedata.list[goodsid].options.price
		scope.pagedata.allprice -= parseInt(price);
		scope.pagedata.orderprice = scope.pagedata.allprice;
		scope.pagedata.refresh();
}
scope.plusup = function(){
		var goodsid =scope.pagedata.goodsid;
		var optionsid = scope.pagedata.list[goodsid].options.id
		scope.pagedata.carts[goodsid].options[optionsid].num ++
		var num = scope.pagedata.carts[goodsid].options[optionsid].num
		var price = scope.pagedata.list[goodsid].options.price
		console.log('scope.pagedata.carts');console.log(scope.pagedata.carts);
		scope.update();
		scope.pagedata.allprice += parseInt(price);
		scope.pagedata.orderprice = scope.pagedata.allprice;
		scope.pagedata.orderprice -=parseFloat(scope.pagedata.post.coupon_de_price);
		scope.pagedata.refresh();
}
//选择
scope.pagedata.get_optionsid=function(k,sid){
	var goodsid = scope.pagedata.goodsid;
	console.log('goodsid');console.log(goodsid);
	scope.pagedata.carts[goodsid]=scope.pagedata.carts[goodsid]?scope.pagedata.carts[goodsid]:{}
	scope.pagedata.carts[goodsid].specid=scope.pagedata.carts[goodsid].specid?scope.pagedata.carts[goodsid].specid:[]
	scope.pagedata.carts[goodsid].options=scope.pagedata.carts[goodsid].options?scope.pagedata.carts[goodsid].options:{};
	scope.pagedata.carts[goodsid].specid[k]=sid;
	console.log('carts');console.log(scope.pagedata.carts);
	var specid = scope.pagedata.carts[goodsid].specid;
	console.log('specid');console.log(specid);
	specid = specid.join('_');
	scope.post_json('jy_weishop/get_data/get_optionsid/',{'specid':specid,'goodsid':goodsid},function(res){
		if(res.options.id){
					console.log('res.options');console.log(res.options);
					scope.pagedata.carts[goodsid].title=scope.pagedata.list[goodsid].title
					scope.pagedata.carts[goodsid].options[res.options.id]=scope.pagedata.carts[goodsid].options[res.options.id]?scope.pagedata.carts[goodsid].options[res.options.id]:res.options
					scope.pagedata.carts[goodsid].options[res.options.id].id=res.options.id;
					scope.pagedata.carts[goodsid].options[res.options.id].num=scope.pagedata.carts[goodsid].options[res.options.id].num?scope.pagedata.carts[goodsid].options[res.options.id].num:0;
					scope.pagedata.carts[goodsid].options[res.options.id].title=res.selespename;
					scope.pagedata.list[goodsid].options=res.options;
					scope.$evalAsync();
		}
	});
}
scope.addfoot = function(goodsid,goods){
		scope.pagedata.carts[goodsid]=scope.pagedata.carts[goodsid]?scope.pagedata.carts[goodsid]:{}
		scope.pagedata.carts[goodsid].num=scope.pagedata.carts[goodsid].num?scope.pagedata.carts[goodsid].num:0
		scope.pagedata.carts[goodsid].num ++
		if(goods){
			scope.pagedata.carts[goodsid].title=goods.title
			scope.pagedata.carts[goodsid].price=goods.price
			var price = goods.price
		}else{
			scope.pagedata.carts[goodsid].title=scope.pagedata.list[goodsid].title
			scope.pagedata.carts[goodsid].price=scope.pagedata.list[goodsid].price
			var price = scope.pagedata.list[goodsid].price
		}
		console.log('scope.pagedata.carts');console.log(scope.pagedata.carts);
		scope.update();
		scope.pagedata.allprice += parseInt(price);
		scope.pagedata.orderprice = scope.pagedata.allprice;
		scope.pagedata.refresh();
		scope.$evalAsync();
}
scope.pagedata.getgoods=function(){
		if(!scope.pagedata.productsn){
			scope.message('请输入国家药品条码！');
			return false;
		}
		scope.get('jy_weishop/get_data/getonegoods/productsn='+scope.pagedata.productsn,function(res){
			if(!res.goods || !res.goods.id){
				scope.msg('没找到该药品！');
				return false;
			}
			scope.pagedata.productsn=''
			scope.addfoot(res.goods.id,res.goods);
		});
}
scope.unsetcarts = function(){
	scope.pagedata.carts={}
}
scope.pagedata.getlist=function(isnew){
		if(isnew){
			scope.pagedata.params.page=1
		}
		var query=scope.made_query(scope.pagedata.params);
		scope.get('/worker.kaiyao/getlist/'+query,function(res){
			scope.pagedata.list=res.list;
			scope.pagedata.totalpage=res.totalpage;
			if(isnew && !scope.pagedata.carts){
				scope.pagedata.allnum=res.allnum;
				scope.pagedata.allprice=res.allprice;
				scope.pagedata.orderprice=res.orderprice;
				scope.pagedata.carts=res.carts;
			}
			scope.$evalAsync();
		});
}
scope.pagedata.getlist(1);
scope.pagedata.getmember=function(noexi){
		if(!scope.pagedata.post.mobile){
			scope.message('请输入手机号！');
			return false;
		}
		scope.pagedata.memberloading=true
		scope.post_json('jy_weishop/get_data/getordermember/iscoupon=1&mobile='+scope.pagedata.post.mobile+'&merchid='+scope.pagedata.merchid+'&orderid='+scope.pagedata.oldorder.id,scope.pagedata.carts,function(res){
			scope.pagedata.memberloading=false
	
			if(!res.member && !res.member.mobile){
				if(!noexi){
					scope.message('没找到该会员！');
				}
				return false;
			}
			if(!res.member && !res.member.paycode){
				if(!noexi){
					scope.message('没找到该会员！');
				}
				return false;
			}
			//console.log(res)
			scope.pagedata.post.mid=res.member.id;
			scope.pagedata.post.member=res.member;
			scope.pagedata.post.level_de_price = res.level_de_price;
			scope.pagedata.post.memberprice = res.order.memberprice;
			scope.pagedata.post.lsprice = res.order.lsprice;
			if(res.coupons && res.couponscount==1){
				scope.pagedata.coupons=res.coupons;
				scope.pagedata.post.coupon_de_price=res.coupons[0].de_price
				scope.pagedata.post.couponid=res.coupons[0].id
				scope.pagedata.post.title5=res.coupons[0].coupon.title5
			}else{
			    scope.pagedata.coupons=res.coupons;
			    scope.pagedata.post.title5='该用户有'+res.couponscount+'张优惠劵'
			}
			scope.pagedata.refresh()
		});
}
if(scope.pagedata.post.mobile){
	scope.pagedata.getmember(1);
}
scope.pagedata.checkcoupon=function(type){
	if(type){
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.coupon_de_price=scope.pagedata.post.deduct
		}else{
			scope.pagedata.post.coupon_de_price=scope.pagedata.goodsprice * (10-scope.pagedata.post.discount) / 10;		
		}
	}else{
		scope.pagedata.post.couponid=0;
		scope.pagedata.post.coupon_de_price=0
	}
	scope.pagedata.showcoupon=false;
	scope.pagedata.refresh()
}
scope.pagedata.gopay=function(){
		scope.pagedata.post.money=scope.pagedata.orderprice
		scope.pagedata.post.carts=scope.pagedata.carts
		if(!scope.pagedata.oldorder || !scope.pagedata.oldorder.id || scope.pagedata.post.topay==1){
			scope.pagedata.payloading=true
		}
		scope.post_json('/worker.kaiyao/addorder/isreturn=1',scope.pagedata.post,function(res){
			if(!scope.pagedata.oldorder || !scope.pagedata.oldorder.id || scope.pagedata.post.topay==1){
				if(res.order_id){
					scope.post_json('/worker.kaiyao/post/order_id='+res.order_id,scope.pagedata.post,function(res){					
					});
				}else{
					scope.message('支付失败！');
				}
				scope.pagedata.payloading=false
			}else{
				scope.message('下单成功！','','goback');
			}
		});
}

//打折药品
scope.pagedata.dazhe=function(){
	scope.confirm({
		'message':'确认要对该药品操作吗？',
		'success':function(){
			if(scope.pagedata.oldorder.status>0){
				scope.message('只有待支付的药单才能操作此药品！','error');
				return false;
			}
			scope.post_json('/worker.kaiyao/dazhe/',scope.pagedata.editdata,function(res){
			    if(scope.pagedata.editdata.isdiscount==1){
			        scope.pagedata.oldorder.goods[scope.pagedata.index].isdiscount= '不打折';
			    }else{
			        scope.pagedata.oldorder.goods[scope.pagedata.index].isdiscount= '打折';
			    }
				scope.pagedata.refresh()
				scope.pagedata.showdaizhe = false
			});
			
		},
		'fail':function(){}
	});
}

scope.pagedata.tuicai=function(){
	scope.confirm({
		'message':'确认要退了该药品吗？',
		'success':function(){
			if(scope.pagedata.oldorder.status>0){
				scope.message('只有待支付的药单才能退药品！','error');
				return false;
			}
			scope.post_json('/worker.kaiyao/tuicai/',scope.pagedata.editdata,function(res){		
				scope.pagedata.oldorder.goods.splice(scope.pagedata.index,1);
				scope.pagedata.refresh()
			});
			
		},
		'fail':function(){}
	});
}
scope.pagedata.tuicainum=function(){
	scope.confirm({
		'message':'确认要退一件该药品吗？',
		'success':function(){
			if(scope.pagedata.oldorder.status>0){
				scope.message('只有待支付的药单才能退药品！','error');
				return false;
			}
			scope.post_json('/worker.kaiyao/tuicainum/',scope.pagedata.editdata,function(res){		
				scope.pagedata.oldorder.goods[scope.pagedata.index].total -=parseInt(scope.pagedata.editdata.tuinum);
				scope.pagedata.showtuicainum=false
				scope.pagedata.refresh()
				window.location.reload();
			});
			
		},
		'fail':function(){}
	});
}
scope.pagedata.songcai=function(){
	scope.confirm({
		'message':'确认要赠送该药品吗？',
		'success':function(){
			if(scope.pagedata.oldorder.status>0){
				scope.message('只有待支付的药单才能赠送药品！','error');
				return false;
			}
			scope.post_json('/worker.kaiyao/songcai/',scope.pagedata.editdata,function(res){		
				scope.pagedata.oldorder.goods[scope.pagedata.index].isgift=1;
				scope.pagedata.oldorder.goodsprice -=scope.pagedata.oldorder.goods[scope.pagedata.index].total_price*1
				scope.pagedata.oldorder.goods[scope.pagedata.index].price=0;
				scope.pagedata.oldorder.goods[scope.pagedata.index].total_price=0;
				scope.pagedata.refresh()
			});
		},
		'fail':function(){}
	});
}
scope.pagedata.gaiprice=function(){
	if(!scope.pagedata.editdata.newendprice || scope.pagedata.editdata.newendprice<0){
		scope.message('最终价格不能小于0！','error');
		return false;
	}
	scope.pagedata.editdata.ordersn = scope.pagedata.oldorder.ordersn
	scope.post_json('/worker.kaiyao/gaiprice/',scope.pagedata.editdata,function(res){

        scope.pagedata.orderprice=res
	    scope.pagedata.endprice=res
	    scope.pagedata.showgaiprice=false;
     	 scope.$evalAsync();
	})
	
}

scope.pagedata.dzprice=function(){
	scope.confirm({
	    'message':'确认要打折该药单吗？',
		'success':function(){
		    if(scope.pagedata.oldorder.status>0){
				scope.message('只有待支付的药单才能操作！','error');
				return false;
			}
			if(!scope.pagedata.editdata.discount || scope.pagedata.editdata.discount<0){
        		scope.message('折扣不能小于0！','error');
        		return false;
        	}
        	if(scope.pagedata.editdata.discount>10){
        		scope.message('折扣不能大于10！','error');
        		return false;
        	}
        	scope.post_json('/worker.kaiyao/dzprice/',scope.pagedata.editdata,function(res){
                //scope.pagedata.orderprice = scope.pagedata.oldorder.merchisdzprice
  
	             scope.pagedata.orderprice=res
             	 scope.pagedata.endprice=res
             	 scope.pagedata.showdzprice=false
             	 scope.$evalAsync();
  
        	})
        	
        	
		}
	    
	})

}

//选择业务销售
scope.pagedata.xzymy=function(){
	scope.confirm({
	    'message':'确认要要选择该业务员销售奖励自动归到该业务员名下吗？',
		'success':function(){
		    if(!scope.pagedata.editdata.storeworkerid){
        		scope.message('请选择对应业务员！','error');
        		return false;
        	}
        	scope.pagedata.editdata.ordersn = scope.pagedata.oldorder.ordersn
		    scope.post_json('/worker.kaiyao/xzywy/',scope.pagedata.editdata,function(res){
                //scope.pagedata.orderprice = scope.pagedata.oldorder.merchisdzprice
	             scope.pagedata.post.storeworkerid = scope.pagedata.editdata.storeworkerid;
             	 scope.pagedata.showxzywy=false
             	 scope.$evalAsync();
  
        	})
		    
		}
	})
}

</script>